package com.woniuxy.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.woniuxy.dao.ProductMapper;
import com.woniuxy.pojo.Product;
import com.woniuxy.service.ProductService;
import com.woniuxy.util.DataGridView;
import com.woniuxy.vo.ProductVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductServiceImpl implements ProductService{
    @Autowired
    private ProductMapper productMapper;
    @Override
    public DataGridView selectCondition(ProductVo productVo) {
        Page<Object> page=PageHelper.startPage(productVo.getPage(),productVo.getLimit());
        List<Product> productList=productMapper.selectCondition(productVo);
        return new DataGridView(page.getTotal(),productList);
    }
}
